Skip to content

feat: Add DevSecOps-7809 demo page with intentional vulnerabilities for GHAS demonstration#137

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/featuredevsecops-demo-4823
Draft

feat: Add DevSecOps-7809 demo page with intentional vulnerabilities for GHAS demonstration#137
Copilot wants to merge 2 commits intomainfrom
copilot/featuredevsecops-demo-4823

Conversation

Copy link

Copilot AI commented Feb 10, 2026

Adds a new DevSecOps demo page (7809) showcasing GitHub Advanced Security detection capabilities through intentional security vulnerabilities in an ASP.NET Core Razor Pages application.

Changes

New Demo Page

  • DevSecOps-7809.cshtml: UI with 2026 GHAS news, interactive vulnerability testing forms
  • DevSecOps-7809.cshtml.cs: PageModel with ILogger and multiple vulnerability categories

Intentional Vulnerabilities

  • Log Forging: Unescaped user input in log messages enabling log injection
    _logger.LogInformation($"User '{userName}' accessed DevSecOps-7809 page from {userAgent}");
  • ReDoS: Exponential backtracking pattern ^(a+)+$ with nested quantifiers
  • Hardcoded Secrets: Database connection strings, API keys in source
  • SQL Injection: String concatenation query construction via BuildUserQuery()
  • Insecure Deserialization: Newtonsoft.Json without type validation

Package Updates

  • Downgraded Newtonsoft.Json from 13.0.1 → 12.0.2 (vulnerable version)
  • Retained vulnerable versions: System.Text.Json 8.0.4, Microsoft.Data.SqlClient 5.0.2

Navigation

  • Updated Index.cshtml with button linking to new demo page

All vulnerabilities should trigger GHAS code scanning alerts, secret scanning, and dependency alerts.

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: DevSecOps (02)</issue_title>
<issue_description>- Use the gh-advsec-devsecops repository from the workspace

  • Create me a new unique branch name under feature/devsecops-demo-[randon-number]
  • Create a new DevSecOps-[random-number].cshtml page and reference it into the Index page.
  • Add some content to it with some latest news about GitHub Advanced Security.
  • Implemented the ILogger for the backend code of the page.
  • For demo purpose, generate some C# insecure code, like log forging or regex exposure
  • Add package System.Text.Json --version 8.0.4
  • Add package Microsoft.Data.SqlClient --version 5.0.2
  • Add package newtonsoft.json --version 12.0.2
  • Build the webapp to make sure there are not build errors.
  • Prepare for committing the changes.</issue_description>

<agent_instructions>Implement this feature</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…or GHAS demonstration

Co-authored-by: CalinL <10718943+CalinL@users.noreply.github.com>
Copilot AI changed the title [WIP] Add DevSecOps page with news and insecure code sample feat: Add DevSecOps-7809 demo page with intentional vulnerabilities for GHAS demonstration Feb 10, 2026
Copilot AI requested a review from CalinL February 10, 2026 05:15
string jsonData = JsonConvert.SerializeObject(LatestSecurityNews);

// VULNERABILITY: Deserializing untrusted data without validation
var deserializedData = JsonConvert.DeserializeObject<List<NewsItem>>(jsonData);
catch (Exception ex)
{
// VULNERABILITY: Excessive error information disclosure
_logger.LogError($"Failed to process input '{userInput}': {ex.ToString()}");
// VULNERABILITY: Log forging - user input directly in logs without sanitization
// Attackers could inject newlines and fake log entries
string userAgent = Request.Headers.UserAgent.ToString();
string userName = Request.Query.ContainsKey("user") ? Request.Query["user"].ToString() ?? "anonymous" : "anonymous";
LoadLatestGHASNews();

// Demonstrate potential ReDoS vulnerability with query parameter
string testPattern = Request.Query.ContainsKey("pattern") ? Request.Query["pattern"].ToString() ?? "aaa" : "aaa";
Comment on lines +64 to +68
catch (Exception ex)
{
// VULNERABILITY: Log forging in exception handling with full stack trace
_logger.LogError($"Regex evaluation failed for pattern: {testPattern}. Error: {ex}");
}
Comment on lines +78 to +81
catch (Exception ex)
{
_logger.LogError($"Database connection failed: {ex.Message}");
}
Comment on lines +176 to +181
catch (Exception ex)
{
// VULNERABILITY: Excessive error information disclosure
_logger.LogError($"Failed to process input '{userInput}': {ex.ToString()}");
TempData["ErrorMessage"] = $"Error: {ex.Message}";
}
Comment on lines +211 to +216
catch (Exception ex)
{
// VULNERABILITY: Logging full exception details with user input
_logger.LogError($"Regex test failed for pattern: {regexPattern}. Exception: {ex}");
TempData["ErrorMessage"] = "Pattern evaluation failed";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: DevSecOps (02)

2 participants